package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import light.head.constant.Sys;

import org.hibernate.annotations.Formula;
@Entity
@Table
public class Reimburse implements Serializable {
	
	/**
	 * 报销
	 */
	private static final long serialVersionUID = 8489874547789005540L;
	private Integer code;
	private String title;					// 标题
	private String department;				// 部门
	private Integer cu;						//创建人编号
	private Date ct;						//创建时间
	private Integer oc;						//机构
	private Boolean deleted = false;		//是否删除
	private String remark;					//备注
	private Double total;					//总金额
	private String capital;					//大写
	private Byte pass = Sys.B_ONE;			//状态（1.未审核2.不通过3.通过4.审核中）
	private Date pt;
	private String cn;
	private String on;
	
	List<ReimburseItem> itemList;			//申请明细
	List<AuditStatus> auditStatusList;		// 审核状态
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getTitle() {
		return title;
	}
	@Column
	public String getDepartment() {
		return department;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public Double getTotal() {
		return total;
	}
	@Column
	public String getCapital() {
		return capital;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu )")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Transient
	public List<ReimburseItem> getItemList() {
		return itemList;
	}
	@Transient
	public List<AuditStatus> getAuditStatusList() {
		return auditStatusList;
	}
	@Column
	public Byte getPass() {
		return pass;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getPt() {
		return pt;
	}
	
	
	
	public void setPt(Date pt) {
		this.pt = pt;
	}
	public void setPass(Byte pass) {
		this.pass = pass;
	}
	public void setAuditStatusList(List<AuditStatus> auditStatusList) {
		this.auditStatusList = auditStatusList;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setDepartment(String department) {
		this.department = department;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setTotal(Double total) {
		this.total = total;
	}
	public void setCapital(String capital) {
		this.capital = capital;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setItemList(List<ReimburseItem> itemList) {
		this.itemList = itemList;
	}
	
	
	
}
